package com.szcinda.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface OrderFollowRepository extends JpaRepository<OrderFollow, String> {
    List<OrderFollow> findByOrderId(String orderId);

    @Query("select o from OrderFollow o where o.organizationId = ?1 and o.cabinetNumber = ?2 and o.orderId <> ?3")
    List<OrderFollow> findByOrganizationIdAndCabinetNumberAndOrderIdNoEq(String organizationId, String cabinetNumber, String orderId);

    List<OrderFollow> findByOrderIdIn(List<String> orderIds);

    void deleteByOrderId(String orderId);

    List<OrderFollow> findByOrganizationIdIn(List<String> orgIds);

    List<OrderFollow> findByCabinetNumber(String cabinetNumber);
}
